package fr.ssd.sic;

import java.io.IOException;

import javax.mail.Folder;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Store;

import fr.ssd.sic.config.Configurator;
import fr.ssd.sic.ui.SimUi;


public class SimpleImapClient {

	/**
	 * @param args
	 * @throws MessagingException 
	 * @throws IOException 
	 */
	public static void main(String[] args) throws MessagingException, IOException {
		Configurator config = new Configurator();
		config.load();
		
		Session session = Session.getDefaultInstance(config.properties, null);
		Store store = session.getStore(config.protocol);
		store.connect(config.serverHost, config.userName, config.userPassword);
		Folder folder = store.getFolder(config.rootFolder);
		
		new SimUi(folder).createAndShowGUI();
		
	}
}
